package cn.zqy.demo2.day01.demo03;

/**
 * String和StringBuilder相互转化
 *  String --> StringBuilder :  new StringBuilder(String str);
 *  StringBuilder --> String :StringBuilder中的toString方法。
 *
 * */
public class Demo03StringBuilder {
    public static void main(String[] args) {
        String s = "aaa";
        /*1.String --> StringBuilder*/
        StringBuilder b = new StringBuilder(s);
        b.append("1111");
        System.out.println("String" + s + "\n"+ "StringBuilder" + b);

        /*2.StringBuilder --> String*/
        String s1 = b.toString();
        System.out.println(s1);
    }
}
